<!DOCTYPE html>
<html>

<head>
  
  <title>gecco 中 @JSVar 的使用方法 | 布.</title>
  <meta name="google-site-verification" content="" />
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta itemprop="name" content="布." />
  <meta itemprop="description" content="漫长岁月" />
  <meta itemprop="image" content="" />
  <link rel="shortcut icon" href="" type="image/x-icon">
  <!-- keywords and description -->
  
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  
  
<link rel="stylesheet" href="/css/style.css">

  <script src="//cdn.jsdelivr.net/npm/@waline/client/dist/Waline.min.js"></script>
<meta name="generator" content="Hexo 6.0.0"></head>

<body>
  <div id="container">
    <header>
  <div class="site-title">
    <a href="/">
      布.
    </a>
  </div>
  
  <div class="site-subtitle">
    漫长岁月
  </div>
  
  
  <p class="links">
    
    <a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_29485177">
      <img src="/images/links/link.png" alt="CSDN">
    </a>
    
  </p>
  
</header>
    <div id="main">
      <article class="post">
  <h3 class="date">
  <time datetime="2022-03-02T02:18:30.000Z">
    Mar 2, 2022
  </time>
</h3>
  <h1>gecco 中 @JSVar 的使用方法</h1>
  <p class="post-info">
  
  
</p>
  
  
  <article>
    <h2 id="gecco-中-JSVar-的使用方法"><a href="#gecco-中-JSVar-的使用方法" class="headerlink" title="gecco 中 @JSVar 的使用方法"></a>gecco 中 @JSVar 的使用方法</h2><h4 id="String、Boolean、Integer"><a href="#String、Boolean、Integer" class="headerlink" title="String、Boolean、Integer"></a>String、Boolean、Integer</h4><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> name = <span class="string">&#x27;xiao ming&#x27;</span>;</span><br><span class="line"><span class="keyword">const</span> male = <span class="literal">true</span>;</span><br><span class="line"><span class="keyword">const</span> age = <span class="number">23</span>;</span><br></pre></td></tr></table></figure>

<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@JSVar(var = &quot;name&quot;)</span></span><br><span class="line"><span class="keyword">private</span> String name;</span><br><span class="line"></span><br><span class="line"><span class="meta">@JSVar(var = &quot;male&quot;)</span></span><br><span class="line"><span class="keyword">private</span> Boolean male;</span><br><span class="line"></span><br><span class="line"><span class="meta">@JSVar(var = &quot;age&quot;)</span></span><br><span class="line"><span class="keyword">private</span> Integer age;</span><br><span class="line"></span><br><span class="line"><span class="comment">// getter and setter</span></span><br></pre></td></tr></table></figure>

<h4 id="Object"><a href="#Object" class="headerlink" title="Object"></a>Object</h4><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> man = &#123;</span><br><span class="line">    <span class="attr">name</span>: <span class="string">&#x27;xiao ming&#x27;</span>,</span><br><span class="line">    <span class="attr">age</span>: <span class="number">23</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@JSVar(var = &quot;man&quot;, jsonpath = &quot;$.name&quot;)</span></span><br><span class="line"><span class="keyword">private</span> String name;</span><br><span class="line"></span><br><span class="line"><span class="meta">@JSVar(var = &quot;man&quot;, jsonpath = &quot;$.age&quot;)</span></span><br><span class="line"><span class="keyword">private</span> Integer age;</span><br><span class="line"></span><br><span class="line"><span class="comment">// getter and setter</span></span><br></pre></td></tr></table></figure>

<h4 id="Array"><a href="#Array" class="headerlink" title="Array"></a>Array</h4><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> manList = [<span class="string">&#x27;xiao ming&#x27;</span>, <span class="string">&#x27;xiao wang&#x27;</span>, <span class="string">&#x27;xiao li&#x27;</span>];</span><br></pre></td></tr></table></figure>

<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@JSVar(var = &quot;manList&quot; , jsonpath = &quot;$[0]&quot;)</span></span><br><span class="line"><span class="keyword">private</span> String man1;</span><br><span class="line"></span><br><span class="line"><span class="comment">// getter and setter</span></span><br></pre></td></tr></table></figure>

<h4 id="Function"><a href="#Function" class="headerlink" title="Function"></a>Function</h4><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> <span class="title function_">manFn</span> = (<span class="params"></span>) =&gt; <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;this is a function&#x27;</span>);</span><br></pre></td></tr></table></figure>
<p>暂时不知道如何获取</p>

  </article>
  
</article>


    </div>
  </div>
  <footer>
  
  
  <p>
    Powered by <a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a> | Theme <a target="_blank" rel="noopener" href="https://github.com/syy11cn/hexo-theme-linear">Linear</a> from <a target="_blank" rel="noopener" href="https://syy11.cn">Yiyang Sun</a>
  </p>
</footer>
  
  <script src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js">
  </script>
  <script>
    Waline({
      el: '#waline',
      placeholder: '',
      avatar: 'retro',
      visitor: true,
      requiredFields: ['nick', 'mail'],
      serverURL: '',
      emoji: [
        'https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/bilibili',
        'https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/qq',
        'https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/alus',
        'https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/tw-emoji',
        'https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/weibo',
        'https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/tieba',
      ]
    });
  </script>
</body>

</html>